<?php
/*
 DELETE.INC.PHP by martin $ 2007/03/26 03:34:15
*/

checkADMIN();

if(isset($theme)){
 $DIVISION['style'] .= '<link rel="stylesheet" id="ppBlogCSS" href="'.$theme.'" type="text/css" />';
}

function del_form($id){ // 削除フォーム
 global $DIVISION;
 $LINES = file(log_($id));
 
 list($id,$cat,$title,$com,$author,$allowcmt,$allowpng,,$extended) = explode('|', $LINES[get_article_index($id, $LINES)]);

 preg_match_all('{<img src="(.+?)" .+?/>}', $com.$extended, $mt); $imgs_list = implode(',', $mt[1]);
 preg_match_all('{\[media:(.+?):.+?\]}', $com.$extended, $mt); $media_list = implode(',', $mt[1]);
 
 $DIVISION['body'] .= '<h4><span class="alert">以下の内容を削除します。</span></h4>'.NL;
 $DIVISION['body'] .= '
 <form method="post" action="admin.php">
 <div class="hidden">
  <input type="hidden" name="mode" value="delete" />
  <input type="hidden" name="UID" value="'.$id.'" />
  <input type="hidden" name="imgs_list" value="'.htmlspecialchars($imgs_list).'" />
  <input type="hidden" name="media_list" value="'.htmlspecialchars($media_list).'" />
  <input type="hidden" name="tags" value="'.tags($id).'" />
  <input type="hidden" name="check" value="1" />
 </div>
 <div style="width: 250px; margin: auto; text-align: center;">
  <input type="image" src="Images/delete1.png"
    onmouseover="this.src=\'Images/delete2.png\';"
    onmouseout="this.src=\'Images/delete1.png\'" alt="Delete" title="削 除" />&nbsp;&nbsp;&nbsp;
  <input type="image" src="Images/reload1.png" onclick="history.go(-1);return false;"
    onmouseover="this.src=\'Images/reload2.png\';"
    onmouseout="this.src=\'Images/reload1.png\'" alt="Return" title="やっぱり削除しない" />
  </div>
 '._box($id,$cat,$title,$com.'<!--END-->', ",", 0, 0 , 0, 0 , '', 1, 0).'
</form>
';
}

function tags($id=''){
 global $TAGS_LIST;
 $tags = '';
 include_once (OD.'tags.ini.php');
 $hits = preg_grep("/".substr($id, 0, 10)."/", $TAGS_LIST);
 $hits = array_values($hits);
 if(!empty($hits)){
  foreach ($hits as $tag){
   list($t,) = explode('|', $tag);
   $tags .= "$t ";
  }
 }
 return trim($tags);
}

?>